package com.mine.client.view.forms;

import com.mine.client.view.ImageIcons;
import com.mine.client.view.Images;

import javax.swing.*;
import java.awt.*;
import java.awt.image.ImageObserver;


/**
 * @author jalasmart
 * 2024/3/20 11:35
 */
public class TestFrame extends JFrame {

    public TestFrame() {
        this.setBounds(new Rectangle(500, 500, 500, 500));
//        this.setIconImages(Arrays.asList(ImageIcons.CLOSE_A_30_30.getImage(), ImageIcons.CLOSE_B_30_30.getImage()));
        this.setTitle("Testing(Beta)");
        //窗口居中
        Toolkit defaultToolkit = Toolkit.getDefaultToolkit();
        Dimension screenSize = defaultToolkit.getScreenSize();
        setLocation(screenSize.width / 2 - 500 / 2, screenSize.height / 2 - 500 / 2);
        //图标
        Image image = ImageIcons.LOGO_0.getImage();
//        int width = image.getWidth(ImageIcons.WEEK_MONDAY.getImageObserver());
//        int height = image.getHeight(ImageIcons.WEEK_MONDAY.getImageObserver());
//        System.out.println(width + " " + height);
//        this.setIconImage(image);
        // .getScaledInstance(512, 512, Image.SCALE_SMOOTH)
        this.setIconImage(image);
//        // 去掉窗口的装饰
//        this.setUndecorated(true);
//        //采用指定的窗口装饰风格
//        this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);

//        this.getContentPane().setBackground(Color.WHITE);
//        this.getContentPane().setLayout(null);


        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        EventQueue.invokeLater(() -> {
            TestFrame testFrame = new TestFrame();
            //是否允许用户改变窗口大小
            testFrame.setResizable(false);
            //设置窗口可见
            testFrame.setVisible(true);
        });
    }
}
